<?php
/**
 * com_easiv3
 * 
 * @author Lukas Gruber
 * @copyright 2012, Lukas Gruber
 * @license GNU/GPLv3 - http://www.gnu.org/licenses/gpl-3.0.html
 * @contact lukasgruber@gmx.net
 * @website http://www.lukasg255.bplaced.net
 */

	/*
	 * Building the content of the extension overview table
	 */
	$counter = 0;
	
	foreach($this->extensions as $extension) {
		echo "<tr>";
			echo "<td>".$extension->extension." v".$extension->version."</td>";

			$status = substr($this->localInstallStatus[$extension->extension], 0, strpos($this->localInstallStatus[$extension->extension], ':'));
			$installedVersion = substr($this->localInstallStatus[$extension->extension], strpos($this->localInstallStatus[$extension->extension], ':')+1);
			
			if($status == "true") {
				$image = "<img src=\"components/com_easiv3/images/true.png\" />";
				$msg = "v".$installedVersion;
			}
			else {
				$image = "<img src=\"components/com_easiv3/images/false.png\" />";
				$msg = "";
			}
			
			echo "<td align=\"center\" valign=\"middle\"><input type=\"checkbox\" name=\"selected[]\" value=\"".$extension->extension.":LOCAL:".$this->localInstallStatus[$extension->extension]."\" />".$image."<br>".$msg."</td>";
			
			foreach($this->remoteInstanceObjects as $instance) {
				$status = substr($this->remoteInstallStatus[$instance->name][$extension->extension], 0, strpos($this->remoteInstallStatus[$instance->name][$extension->extension], ':'));
				$installedVersion = substr($this->remoteInstallStatus[$instance->name][$extension->extension], strpos($this->remoteInstallStatus[$instance->name][$extension->extension], ':')+1);
				
				if( $status == "true") {
					$image = "<img src=\"components/com_easiv3/images/true.png\" />";
					$msg = "v".$installedVersion;
				}
				else {
					$image = "<img src=\"components/com_easiv3/images/false.png\" />";
					$msg = "";
				}
				//print out the installstatus. The checkboxes have the following value: 'extensionName:JoomlaInstance:intallStatus'
				echo "<td align=\"center\" valign=\"middle\"><input type=\"checkbox\" name=\"selected[]\" value=\"".$extension->extension.":".$instance->name.":".$this->remoteInstallStatus[$instance->name][$extension->extension]."\" />".$image."<br>".$msg."</td>";
			}
			
		echo "</tr>";
		
		$counter++;
	}
?>